<include file="Public/header"/>
<div class="wrapper m-t">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <a class="h3 font-bold">会员中心【会员列表】</a>
        </div>
        <div class="ibox-content">

            <table class="table table-striped b-t b-light text-sm table-bordered">
                <thead>
                <tr>
                    <th width="10 "><input type="checkbox"></th>
                    <th>ID</th>
                    <th>经销商</th>
                    <th>姓名</th>
                    <th>区域</th>
                    <th>电话</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <volist name="_list" id="vo" key="k">
                    <tr>
                        <td><input type="checkbox" name="post[]" value="{$vo.id}"></td>
                        <td>{$vo.id}</td>
                        <td>{$vo.company_name}</td>
                        <td>{$vo.username}</td>
                        <td>{$vo.area_name}</td>
                        <td>{$vo.mobile_phone}</td>

                        <td>
                            <if condition="$vo.status eq 1">
                                正常
                                <elseif condition="$vo.status eq 0"/>
                                禁用
                                <else/>

                            </if>
                        </td>

                        <td>
                            <a data-toggle="modal" data-target="#usermessage" onclick="userinfo({$vo.id},'{$vo.area_name}')" class="text-info">详情</a>&nbsp;&nbsp;|
                          <if condition="$vo.status eq 1">
                              <a  href="{:U('Users/changeStatus?id='.$vo['id'].'&status=0')}" class="text-info confirm ajax-get">禁用</a>&nbsp;&nbsp;
                              <elseif condition="$vo.status eq 0"/><a href="{:U('Users/changeStatus?id='.$vo['id'].'&status=1')}" class="text-info confirm ajax-get">启用</a>&nbsp;&nbsp;
                          </if>

                        </td>
                    </tr>
                </volist>
                </tbody>
            </table>
            <div>{$_page}</div>
        </div>
    </div>
</div>
<!--用户信息弹框-->
<div class="modal inmodal" id="usermessage" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">&times;</span>
                    <span class="sr-only">关闭</span>
                </button>
            </div>
            <div class="modal-body">
                <div class="contact-box">
                    <div class="col-sm-4">
                        <div class="text-center">
                            <img id="headimg" alt="image" class="img-circle m-t-xs" src="" width="100" height="100">
                            <div class="m-t font-bold h4" id="nickname"></div>
                        </div>
                    </div>
                    <div class="col-sm-8">
                        <div class="col-sm-6 m-b m-t-lg h4"><i class="fa fa-user"></i> <span id="name"></span></div>
                        <div class="col-sm-6 m-b m-t-lg h4"><i class="fa fa-users"></i> <span id="sex"></span></div>
                        <div class="col-sm-6 m-b-lg h4"><i class="fa fa-compass"></i> <span id="quyu"></span></div>
                        <div class="col-sm-6 m-b-lg h4"><i class="fa fa-adjust"></i> <span id="state"></span></div>
                        <address class="panel-heading">
                            <div class="m-b-xs h4"><i class="fa fa-building-o"> </i>：<span id="gsm"></span></div>
                            <div class="m-b-xs h4"><i class="fa fa-phone"> </i>：<span id="tel"></span></div>
                            <div class="m-b-xs h4"><i class="fa fa-map-marker"> </i>：<span id="dz"></span></div>
                            <div class="m-b-xs h4"><i class="fa fa-pencil"> </i>：<span id="bz"></span></div>
                            <div class="m-b-xs h4"><i class="fa fa-calendar-o"> </i>：<span id="rtime"></span></div>
                        </address>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<!--用户信息弹框 endif-->
<include file="Public/footer"/>
<script>
    function getLocalTime(nS) {
        return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
    }
    function userinfo(id,info){
        $.post("{:U('Users/userInfo')}",{id:id},function(re){
            var sex,state;
            if(re.sex ==1 ){
                sex='男';
            }else if(re.sex==0){
                sex='女';
            }else{
                sex='未知';
            }
            if(re.status==1){
                state='正常';
            }else{
                state='禁用';
            }
            $("#headimg").attr('src',re.headimgurl);
            $("#nickname").html(re.nickname);
            $("#name").html(re.username);
            $("#sex").html(sex);
            $("#quyu").html(info);
            $("#state").html(state);
            $("#gsm").html(re.company_name);
            $("#tel").html(re.mobile_phone);
            $("#dz").html(re.company_address);
            $("#bz").html(re.remark);
            $("#rtime").html(getLocalTime(re.sr_time));


        })
    }



</script>
